import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '主页',
    component: Home
  },
  {
    path: "/login",
    component: () => import("../views/Login"),
    name: "登录页"
  },
  {
    path: "/register",
    component: () => import("../views/Register"),
    name: "注册页"
  },
  {
    path: "/typeList/:type",
    component: () => import("../views/TypePage"),
    name: "分类商品页"
  },
  {
    path: "/search",
    component: () => import("../views/Search"),
    name: "搜索结果页"
  },
  {
    path: "/detail",
    component: () => import("../views/Detail"),
    name: "商品详情"
  },
  {
    path: "/shopCar",
    component: () => import("../views/ShopCar"),
    name: "购物车"
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
